<template>
    <div class="page">
        <div class="page_content">
            <div class="head">
                <div class="product-title">建筑设计</div>
                <div class="goback" :onclick="goback">返回<img src="@/assets/right.png" alt=""></div>
            </div>
            <div class="message">
                <div class="centermMessage">
                    <div class="pic">
                        <Swiper style="height: 100%;" :slidesPerView="1" :loop="true" @swiper="onSwiper"
                            @slideChange="onSlideChange" ref="swiper">
                            <SwiperSlide class="Slide">
                                <img src="@/assets/project.jpg" alt="">
                            </SwiperSlide>
                            <SwiperSlide class="Slide">
                                <img src="@/assets/project.jpg" alt="">
                            </SwiperSlide>
                        </Swiper>
                        <div class="changeButtom">
                            <div style="margin-bottom: 10px;" @click="goToPrevSlide"> <img src="@/assets/leftSlip.png"
                                    alt=""></div>
                            <div @click="goToNextSlide"><img src="@/assets/rightSlip.png" alt=""></div>
                        </div>
                    </div>

                    <div class="rightMessage">
                        <div class="title">杭州湾奥特莱斯</div>
                        <p>杭州湾奥特莱斯拟打造为一个商业娱乐综合体，集奥特莱斯商业体，IP奥莱、文化娱乐休闲于一体。设计师们将深度挖掘这座城市的地质特色与人文属性，创造出开放式商业趣味的舒适未来场景，把游逛、赏景、购物紧密相连，打造兼具主题性、互动性与体验性的商业空间。
                        </p>

                        <div class="bottom">
                            <div class="tips" v-for="item in 6">
                                <label>建设地点 : </label>
                                <label>浙江·宁波</label>
                            </div>
                        </div>
                        <div class="upAndDown">
                            <button style="margin-right: 1rem;">上一篇</button>
                            <button>下一篇</button>
                        </div>

                    </div>

                </div>

            </div>

        </div>
    </div>
</template>

<script setup>
// 导入 Swiper 和 SwiperSlide 组件
import { Swiper, SwiperSlide } from 'swiper/vue';
import { register } from 'swiper/element/bundle';
import { useRouter } from 'vue-router';
import { ref } from 'vue';
const router = useRouter()

register();

// 导入 Swiper 样式
import 'swiper/css';
import 'swiper/css/pagination';

const swiper = ref(null);
// 定义 Swiper 事件处理方法
const onSwiper = (swiperInstance) => {
    swiper.value = swiperInstance;
};

// 跳转到前一个 slide
const goToPrevSlide = () => {
    swiper.value?.slidePrev();
};

// 跳转到下一个 slide
const goToNextSlide = () => {
    swiper.value?.slideNext();
};
// 滑动轮播图
const onSlideChange = () => {
    // console.log('slide change');
};

const goback = () => {
    router.go(-1);
}
</script>

<style lang="scss" scoped>
.page {
    background: #e8e8e8;
    height: 100%;
    width: 100%;
    border-top: 1px solid;

    .page_content {
        .head {
            display: flex;
            justify-content: space-between;
            align-items: end;
            margin-bottom: 1rem;
            margin-top: 3rem;

            .product-title {
                font-size: 3.5rem;
                color: #666;
                // margin-bottom: 25px;
                // margin-top: 25px;
            }

            .goback {
                font-size: 16px;
                color: #9a9a9a;
                display: flex;
                justify-content: start;
                text-align: center;
                align-items: center;
                cursor: pointer;


                img {
                    width: 1.8rem;
                    height: 1.8rem;
                }
            }
        }

        .message {
            display: flex;
            width: 100%;
            height: 45.2rem;
            background-color: white;
            align-items: center;

            .centermMessage {
                width: 100%;
                height: 70%;
                display: flex;
                justify-content: start;
                align-items: center;
                // background-color: pink;

                .pic {
                    position: relative;
                    width: 45rem;
                    height: 100%;

                    img {
                        width: 100%;
                        height: 100%;
                    }

                    .changeButtom {
                        position: absolute;
                        right: -20px;
                        bottom: 10%;
                        z-index: 9999;

                        div {
                            width: 40px;
                            height: 40px;
                            background-color: #aaa9a9;
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            cursor: pointer;

                            img {
                                width: 20px;
                                height: 20px;

                            }
                        }

                        div:hover {
                            background-color: black;
                            /* 点击时背景变黑 */
                        }
                    }
                }

                .rightMessage {
                    position: relative;
                    display: flex;
                    flex-direction: column; // 设置为纵向排列
                    justify-content: start;
                    margin-left: 2rem;
                    margin-right: 9rem;
                    height: 100%;

                    .title {
                        font-size: 3.46rem;
                        margin-bottom: 1.6rem;
                        margin-top: 7rem;
                    }

                    p {
                        margin-bottom: 1.3rem;
                        font-size: 1rem;
                        line-height: 1.6rem;
                        color: #6a6a6a;
                    }

                    .bottom {
                        display: flex;
                        justify-content: start;
                        width: 100%;
                        flex-wrap: wrap; // 允许换行
                        color: #6a6a6a;

                        .tips {
                            width: 13rem;

                        }
                    }

                    .upAndDown {
                        position: absolute;
                        bottom: 0;

                        button {
                            width: 70px;
                            height: 30px;
                            border: 1px solid #aaa;
                            font-size: 16px;
                            font-weight: 600;
                            padding: 5px 10px;
                            background: white;
                        }
                    }

                }
            }
        }
    }
}
</style>